package com.starlink.common.enums;

import java.util.Arrays;

public enum ActionTypeEum {
    PERFECT_PERSONAL_INFO(0, "完善个人信息"),
    BIND_PHONE_NUMBER(1, "绑定手机号"),
    CHECK_IN_AND_EARN_POINTS(2, "签到领积分"),
    BROWSE_PAGE(3, "浏览页面"),
    PLACE_ORDER_AND_CONSUME(4, "下单消费"),
    INVITE_FRIENDS_TO_REGISTER(5, "邀请好友注册"),
    SHARE_CONTENT(6, "分享内容"),
    INTEGRATION_CANCEL(7, "积分商品订单取消"),
    POINTS_EXCHANGE(20, "积分兑换"),
    CONSUMPTION_REFUND(21, "消费退款"),
    JOIN_STAR_PAINT_ACTIVITY(22, "参加活动"),
    STAR_PAINT_ACTIVITY_CANCEL(23, "活动取消退还积分"),
    INVITER_SCHOOLBAG_BUG(24, "书包购买（邀请人）"),
    ;

    private final int type;
    private final String desc;

    ActionTypeEum(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public int getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public static ActionTypeEum getByType(Integer type) {
        if (type == null) {
            return null;
        }
        return Arrays.stream(values()).filter(item -> type.equals(item.getType())).findFirst().orElse(null);
    }
}
